<template>
  <a-drawer :width="500" :visible="show" :footer="false" @cancel="handleCancel" unmountOnClose>
    <template #title>
      {{data.type}}组件编辑
    </template>
    <div class="setting-content">
      <!-- 组件自身属性 -->
      <div class="setting-header flex items-center">
        <span class="header-title">组件宽度</span>
        <a-select v-model="data.data.width" placeholder="请选择" allow-clear>
          <a-option value="default">默认</a-option>
          <a-option value="small">小</a-option>
          <a-option value="middle">中</a-option>
          <a-option value="max">大</a-option>
        </a-select>
      </div>
      <div class="setting-header flex items-center">
        <span class="header-title">组件背景</span>
        <a-select v-model="data.data.bgColor" placeholder="请选择" allow-clear>
          <a-option value="#ffffff">白色</a-option>
          <a-option value="#F7F7FA">灰色</a-option>
        </a-select>
      </div>
      <div class="setting-header flex items-center">
        <span class="header-title">是否显示下划线</span>
        <a-select v-model="data.data.hasLine" placeholder="请选择" allow-clear>
          <a-option :value="true">是</a-option>
          <a-option :value="false">否</a-option>
        </a-select>
      </div>

      <p class="item-title">标题</p>
      <RichTextEditor v-model="data.data.text" :name="`QuoteText_editor_text`"></RichTextEditor>

      <p class="item-title">内容</p>
      <RichTextEditor v-model="data.data.desc" :name="`QuoteText_editor_desc`"></RichTextEditor>
    </div>
  </a-drawer>
</template>

<script lang="ts" setup>
import { defineAsyncComponent } from 'vue'
const RichTextEditor = defineAsyncComponent(() => import("@/common/RichTextEditor/index.vue"));

defineProps({
  show: {
    type: Boolean,
    default: false
  },

  data: {
    type: Object,
    default: () => {}
  }
})

const emit = defineEmits(['update:show']);

const handleCancel = () => {
  emit('update:show', false);
}
</script>

<style lang="scss" scoped>
.setting-content {
  .setting-header {
    padding-bottom: 12px;

    .header-title {
      width: 120px;
      padding-right: 12px;
      text-align: right;
    }
  }

  .item-title {
    padding: 12px 0 8px 0;
    font-size: 14px;
    font-weight: 600;
  }
}
</style>